function main(params) {
    debugger
    let arr = this.data.id.split("_index");
    let rowIndex = arr.length === 2 ? parseInt(arr[1]) : 0;
    let dt = this.$$("detail_table_40mrmy");
    const value = dt.$$getCellValue(rowIndex, "single_select_2te3re");
    getUnit(value).then(res => {
        let v = res.result[0].item_unit;
        dt.$$setCellValue(rowIndex, "text_input_3amq3z", v);
    })
}

function getUnit(itemValue) {
    const params = [{
        name: "value",
        valueContent: itemValue
    }];
    return new Promise((resolve, reject) => {
        api.DATA_SOURCE_EXECUTE("ds_mod_a899919d-b1bb-4c90-8508-a49e4af7d34b", "ddcat", params, [], "").then(res => {
            resolve(res);
        });
    })
}
